<?php
function smarty_function_user_select($params, &$smarty)
{
//	echo "<pre>"; var_dump($params); echo "</pre>"; 
	$select = SilkForm::create_input_select(array("name" => "users[]", "multiple" => true, "size" => 20));
	
	$items = array();
	foreach( $params["users"] as $user ) {
		if(( $user->username != "" )) {
			$items[$user->id] = $user->first_name . " " . $user->last_name . " (" . $user->username . ")";
		}
	}
	
	$selected = array();
	foreach( $params["groupUsers"] as $groupUser ) {
		$selected[$groupUser->id] = $groupUser->id;
	}
	
	$select .= SilkForm::create_input_options(array("items" => $items, "selected_values" => $selected));
	$select .= SilkForm::create_end_tag("select");
	return $select;
}

# vim:ts=4 sw=4 noet
?>